package com.ruoyi.common.sms;

/**
 * 腾讯云短信枚举
 * @author Ten
 */

public enum SendSmsEnum {

    VERIFICATION_CODE_LOGIN("2533673", "宿迁迁云信息科技", new String[]{"", "2"}),
    VERIFICATION_CODE_PWD("2533675", "宿迁迁云信息科技", new String[]{""}),
    VERIFICATION_CODE_REGIST("2533674", "宿迁迁云信息科技", new String[]{""});

    private String templateId;
    private String signName;
    private String[] templateParamSet;

    public String getTemplateId() {
        return templateId;
    }

    public void setTemplateId(String templateId) {
        this.templateId = templateId;
    }

    public String getSignName() {
        return signName;
    }

    public void setSignName(String signName) {
        this.signName = signName;
    }

    public String[] getTemplateParamSet() {
        return templateParamSet;
    }

    public void setTemplateParamSet(String[] templateParamSet) {
        this.templateParamSet = templateParamSet;
    }

    SendSmsEnum(String templateId, String signName, String[] templateParamSet) {
        this.templateId = templateId;
        this.signName = signName;
        this.templateParamSet = templateParamSet;
    }

    public static SendSmsEnum verificationCode(SendSmsEnum sendSmsEnum) {
//        if (SendSmsEnum.VERIFICATION_CODE_LOGIN.compareTo(sendSmsEnum) == 0 || ) {
//            // 拼接参数
//        }
        String[] templateParamSet1 = sendSmsEnum.getTemplateParamSet();
        templateParamSet1[0] = String.valueOf(randomCode());
        sendSmsEnum.setTemplateParamSet(templateParamSet1);
        return sendSmsEnum;
    }

    /**
     * 生成6位随机数
     */
    public static int randomCode() {
        return (int) ((Math.random() * 9 + 1) * 100000);
    }

//    public static void main(String[] args) {
//        for (int i = 0; i < 100; i++) {
//
//            System.out.println("randomCode() = " + randomCode());
//        }
//    }
}
